<template>
	<view class="all">
		<u-navbar :title='type?type:"我的合同"' :is-back="true" title-bold>
		</u-navbar>
		<zwp-draw-pad ref='drawPad' :width="690" :height="420" />
		<view class="caozuo">
			<view class="caozuo_1" @click="submit('上一步')">
				<image src="@/static/img/syb1.png" mode=""></image> 上一步
			</view>
			<view class="caozuo_1" @click="submit('清空')">
				<image src="@/static/img/qk.png" mode=""></image> 清空
			</view>
		</view>
		<view class="qd" @click="submit('确定')">
			确定
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				path: '',
				type: '',
			};
		},
		onLoad(e) {
			this.type = e.type ? e.type : ''

		},
		methods: {

			submit(a) {
				if (a == '上一步') {
					this.$refs.drawPad.back()
				} else if (a == '清空') {
					this.$refs.drawPad.init()
				} else if (a == '确定') {
					if(this.type){
						uni.navigateTo({
							url:'./qdzm'
						})
					}
					return
					this.$refs.drawPad.save().then(res => {
						this.$toast('保存成功', 1)
						uni.uploadFile({
							url: that.BASE_URL + '/addons/alioss/oss/upload', //仅为示例，非真实的接口地址
							filePath: that.img1,
							name: 'file',
							header: {
								token: uni.getStorageSync('token')
							},
							success: (a) => {
								console.log(a)
								let c = JSON.parse(a.data).data.fullurl
								console.log(c)
								that.imgtu = c
							}
						})

						console.log('保存图片的地址', res.tempFilePath)
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.caozuo {
		padding: 0rpx 30rpx 30rpx 30rpx;
		display: flex;

		.caozuo_1 {
			margin-right: 20rpx;
			display: flex;
			align-items: center;

			image {
				width: 30rpx;
				height: 30rpx;
			}
		}
	}

	.qd {
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		color: #703F00;
		opacity: 1;
		width: 300rpx;
		height: 88rpx;
		background: #FFD500;
		text-align: center;
		line-height: 88rpx;
		margin: 50rpx auto;
		opacity: 1;
		border-radius: 44px;
	}
</style>
